package com.jibei.mendo.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jibei.mendo.R;

import java.util.List;

/**
 * Created by lhl on 2019/8/24.
 */
public class AboutDevAdapter extends RecyclerView.Adapter {

    private Context mContext;
    private List<String> strings;

    public AboutDevAdapter(Context context, List<String> strings) {
        this.mContext = context;
        this.strings = strings;
    }


    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_about_dev, viewGroup, false);
        return new AboutDevViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
        String string = strings.get(position);
        ((AboutDevViewHolder) viewHolder).mText.setText(string);
    }

    @Override
    public int getItemCount() {
        return strings.size();
    }

    private class AboutDevViewHolder extends RecyclerView.ViewHolder {

        private TextView mText;

        public AboutDevViewHolder(View itemView) {
            super(itemView);
            mText = itemView.findViewById(R.id.tv_about_dev);
        }
    }
}
